﻿using System;
using UnityEngine;

[Serializable]
public struct ModelProperty
{
    public string ModelID;
    public bool IsParticle;
    private Vector position;
    private Vector scale;
    private Vector rotation;
    public bool IsPlaying;
    public Vector3 Position
    {
        set { position = new Vector(value); }
        get { return position.ToVector3(); }
    }
    public Vector3 Scale
    {
        set { scale = new Vector(value); }
        get { return scale.ToVector3(); }
    }
    public Vector3 Rotation
    {
        set { rotation = new Vector(value); }
        get { return rotation.ToVector3(); }
    }

    public ModelProperty(string modelID, bool isParticle, Vector3 position, Vector3 scale, Vector3 rotation, bool isPlaying)
    {
        ModelID = modelID;
        IsParticle = isParticle;
        IsPlaying = isPlaying;
        this.position = new Vector(position);
        this.scale = new Vector(scale);
        this.rotation = new Vector(rotation);
    }

    [Serializable]
    struct Vector
    {
        public float x;
        public float y;
        public float z;
        public Vector(float x, float y, float z)
        {
            this.x = x;
            this.y = y;
            this.z = z;
        }
        public Vector(Vector3 vector3)
        {
            x = vector3.x;
            y = vector3.y;
            z = vector3.z;
        }
        public Vector3 ToVector3()
        {
            return new UnityEngine.Vector3(x, y, z);
        }
    }
}
